import {getlist, upData, addData, remove, validationapi} from '@/api/permissions'

const state = {
    list: []
}
const mutations = {
    SET_LIST(state, res){
        state.list = res.data
    }
}
const actions = {
    async getlist({commit}){
        let { data } = await getlist()
        commit('SET_LIST', data)
    },
    async upData({}, form){
        let {data} = await upData(form);
        return data;
    },
    async addData({}, form){
        let {data} = await addData(form);
        return data;
    },
    async remove({}, id){
        let {data} = await remove(id);
        return data;
    },
    async validation({}, roles){
        let {data} = await validationapi({roles});
        return data;
    }
}
export default {
    namespaced: true,
    state,
    mutations,
    actions
}